#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
int main()
{
	int num = 0;
	scanf("%d", &num) != EOF;
	int arr[1000] = {0};
	int i = 0;
	for (i = 0; i < num; i++)
	{
		scanf("%d ", &arr[i]);
	}
	int del = 0;
	    scanf("%d", &del)!=EOF;
	int count = num;
	while(*(arr+num-1) == del)
	{
		num--;
		count--;
	}
	for (i = num-1; i >= 0; i--)
	{
		if (arr[i] == del)
		{
			int j = i;
			for (j = i; j < num - 1; j++)
			{
				arr[j] = arr[j + 1];
			}
			count--;
		}
	}
	for (i = 0; i < count; i++)
	{
		printf("%d ", arr[i]);
	}
	return 0;
}